<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Vue Css动画原理</title>
    <script charset="UTF-8" src="js/vue.js"></script>
    <style>
        .fade-enter,
        .fade-leave-to{
            opacity: 0;
        }
        .fade-enter-active,
        .fade-leave-active{
            transition:opacity 1s;
        }
    </style>
</head>
<body>
<div id="app">
    <transition name="fade">
        <div v-if="show">
            hello World
        </div>
    </transition>
    <button @click="handleClick">切换</button>
</div>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            show: true
        },
        methods: {
            handleClick: function () {
                this.show = !this.show;
            }
        }
    });
</script>
</body>
</html>